package com.xdf.docmanagementsystem.common.base;

import com.xdf.docmanagementsystem.common.util.IOUtil;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @program: doc-management-system
 * @description: 控制器基类
 * @author: Zhang
 * @create: 2020-06-22 12:37
 **/
@Component
public class BaseController extends BaseService {
    /**
     * 写文件
     *
     * @param list
     * @param path
     */
    protected void writeFiles(List<MultipartFile> list, String path) throws IOException {
        if (list != null && list.size() > 0) {
            for (MultipartFile file : list) {
                IOUtil.writeLocalDir(path, file.getOriginalFilename(), file.getInputStream());
            }
        }
    }

}
